
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <!-- 页面meta -->
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>病患新建</title>
    <meta name="description" content="AdminLTE2定制版">
    <meta name="keywords" content="AdminLTE2定制版">

    <!-- Tell the browser to be responsive to screen width -->
    <meta
            content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no"
            name="viewport">


    <link rel="stylesheet"
          th:href="@{/plugins/bootstrap/css/bootstrap.min.css}">
    <link rel="stylesheet"
          th:href="@{/plugins/font-awesome/css/font-awesome.min.css}">
    <link rel="stylesheet"
          th:href="@{/plugins/ionicons/css/ionicons.min.css}">
    <link rel="stylesheet"
          th:href="@{/plugins/iCheck/square/blue.css}">
    <link rel="stylesheet"
          th:href="@{/plugins/morris/morris.css}">
    <link rel="stylesheet"
          th:href="@{/plugins/jvectormap/jquery-jvectormap-1.2.2.css}">
    <link rel="stylesheet"
          th:href="@{/plugins/datepicker/datepicker3.css}">
    <link rel="stylesheet"
          th:href="@{/plugins/daterangepicker/daterangepicker.css}">
    <link rel="stylesheet"
          th:href="@{/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.min.css}">
    <link rel="stylesheet"
          th:href="@{/plugins/datatables/dataTables.bootstrap.css}">
    <link rel="stylesheet"
          th:href="@{/plugins/treeTable/jquery.treetable.css}">
    <link rel="stylesheet"
          th:href="@{/plugins/treeTable/jquery.treetable.theme.default.css}">
    <link rel="stylesheet"
          th:href="@{/plugins/select2/select2.css}">
    <link rel="stylesheet"
          th:href="@{/plugins/colorpicker/bootstrap-colorpicker.min.css}">
    <link rel="stylesheet"
          th:href="@{/plugins/bootstrap-markdown/css/bootstrap-markdown.min.css}">
    <link rel="stylesheet"
          th:href="@{/plugins/adminLTE/css/AdminLTE.css}">
    <link rel="stylesheet"
          th:href="@{/plugins/adminLTE/css/skins/_all-skins.min.css}">
    <link rel="stylesheet"
          th:href="@{/css/style.css}">
    <link rel="stylesheet"
          th:href="@{/plugins/ionslider/ion.rangeSlider.css}">
    <link rel="stylesheet"
          th:href="@{/plugins/ionslider/ion.rangeSlider.skinNice.css}">
    <link rel="stylesheet"
          th:href="@{/plugins/bootstrap-slider/slider.css}">
    <link rel="stylesheet"
          th:href="@{/plugins/bootstrap-datetimepicker/bootstrap-datetimepicker.css}">
</head>

<body class="hold-transition skin-purple sidebar-mini">

<div class="wrapper">

    <div th:replace="commons/bar::#headerbar"></div>
    <div  th:replace="commons/bar::#sidebar"></div>
    <!-- 导航侧栏 /-->

    <!-- 内容区域 -->
    <div class="content-wrapper">

        <!-- 内容头部 -->
        <section class="content-header">
            <h1>
                确诊病患管理 <small>新建病患</small>
            </h1>
            <ol class="breadcrumb">
                <li><a href="/indexpage"><i
                        class="fa fa-dashboard"></i> 首页</a></li>
                <li><a
                        href="/patient/list/">确诊病患管理</a></li>
                <li class="active">新建病患</li>
            </ol>
        </section>
        <!-- 内容头部 /-->

        <form action="/patient/addBase"
              method="post">
            <!-- 正文区域 -->
            <section class="content"> <!--产品信息-->

                <div class="panel panel-default">
                    <div class="panel-heading">基本信息</div>
                    <div class="row data-type">

                        <div class="col-md-2 title">姓名</div>
                        <div class="col-md-4 data">
                            <input type="text" class="form-control" name="name"
                                   placeholder="姓名" value="">
                        </div>
                        <div class="col-md-2 title">身份证号码</div>
                        <div class="col-md-4 data">
                            <input type="text" class="form-control" name="idCard"
                                   placeholder="身份证号码" onblur="IdentityCodeValid(this.value)" value="">
                        </div>
                        <input type="text" name="msg"
                               value="patient" hidden="">
                        <div class="col-md-2 title">年龄</div>
                        <div class="col-md-4 data">
                            <input type="text" class="form-control" name="age"
                                   placeholder="年龄" value="">
                        </div>


                        <div class="col-md-2 title">性别</div>
                        <div class="col-md-4 data">
                            <select class="form-control select2" style="width: 100%"
                                    name="gender">
                                <option value="男" selected="selected">男</option>
                                <option value="女">女</option>
                            </select>
                        </div>

                        <div class="col-md-2 title">地址</div>
                        <div class="col-md-4 data">
                            <input type="text" class="form-control" placeholder="地址"
                                   name="address" value="">
                        </div>
                        <div class="col-md-2 title">电话号码</div>
                        <div class="col-md-4 data">
                            <input type="text" class="form-control" placeholder="电话号码"
                                   name="phone" value="" onblur="validatemobile(this.value)">
                        </div>

                    </div>
                </div>
                <!--订单信息/--> <!--工具栏-->
                <div class="box-tools text-center">
                    <button type="submit" class="btn bg-maroon">下一步</button>
                    <button type="button" class="btn btn-bitbucket"
                            onclick="history.back(-1);">返回</button>
                </div>
                <!--工具栏/--> </section>
            <!-- 正文区域 /-->
        </form>
    </div>
    <!-- 内容区域 /-->



</div>


<script
        src="/plugins/jQuery/jquery-2.2.3.min.js"></script>
<script
        src="/plugins/jQueryUI/jquery-ui.min.js"></script>
<script>
    $.widget.bridge('uibutton', $.ui.button);
</script>
<script
        th:src="@{/plugins/bootstrap/js/bootstrap.min.js}"></script>
<script
        th:src="@{/plugins/raphael/raphael-min.js}"></script>
<script
        th:src="@{/plugins/morris/morris.min.js}"></script>
<script
        th:src="@{/plugins/sparkline/jquery.sparkline.min.js}"></script>
<script
        th:src="@{/plugins/jvectormap/jquery-jvectormap-1.2.2.min.js}"></script>
<script
        th:src="@{/plugins/jvectormap/jquery-jvectormap-world-mill-en.js}"></script>
<script
        th:src="@{/plugins/knob/jquery.knob.js}"></script>
<script
        th:src="@{/plugins/daterangepicker/moment.min.js}"></script>
<script
        th:src="@{/plugins/daterangepicker/daterangepicker.js}"></script>
<script
        th:src="@{/plugins/daterangepicker/daterangepicker.zh-CN.js}"></script>
<script
        th:src="@{/plugins/datepicker/bootstrap-datepicker.js}"></script>
<script
        th:src="@{/plugins/datepicker/locales/bootstrap-datepicker.zh-CN.js}"></script>
<script
        th:src="@{/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.min.js}"></script>
<script
        th:src="@{/plugins/slimScroll/jquery.slimscroll.min.js}"></script>
<script
        th:src="@{/plugins/fastclick/fastclick.js}"></script>
<script
        th:src="@{/plugins/iCheck/icheck.min.js}"></script>
<script
        th:src="@{/plugins/adminLTE/js/app.min.js}"></script>
<script
        th:src="@{/plugins/treeTable/jquery.treetable.js}"></script>
<script
        th:src="@{/plugins/select2/select2.full.min.js}"></script>
<script
        th:src="@{/plugins/colorpicker/bootstrap-colorpicker.min.js}"></script>
<script
        th:src="@{/plugins/bootstrap-wysihtml5/bootstrap-wysihtml5.zh-CN.js}"></script>
<script
        th:src="@{/plugins/bootstrap-markdown/js/bootstrap-markdown.js}"></script>
<script
        th:src="@{/plugins/bootstrap-markdown/locale/bootstrap-markdown.zh.js}"></script>
<script
        th:src="@{/plugins/bootstrap-markdown/js/markdown.js}"></script>
<script
        th:src="@{/plugins/bootstrap-markdown/js/to-markdown.js}"></script>
<script
        th:src="@{/plugins/ckeditor/ckeditor.js}"></script>
<script
        th:src="@{/plugins/input-mask/jquery.inputmask.js}"></script>
<script
        th:src="@{/plugins/input-mask/jquery.inputmask.date.extensions.js}"></script>
<script
        th:src="@{/plugins/input-mask/jquery.inputmask.extensions.js}"></script>
<script
        th:src="@{/plugins/datatables/jquery.dataTables.min.js}"></script>
<script
        th:src="@{/plugins/datatables/dataTables.bootstrap.min.js}"></script>
<script
        th:src="@{/plugins/chartjs/Chart.min.js}"></script>
<script
        th:src="@{/plugins/flot/jquery.flot.min.js}"></script>
<script
        th:src="@{/plugins/flot/jquery.flot.resize.min.js}"></script>
<script
        th:src="@{/plugins/flot/jquery.flot.pie.min.js}"></script>
<script
        th:src="@{/plugins/flot/jquery.flot.categories.min.js}"></script>
<script
        th:src="@{/plugins/ionslider/ion.rangeSlider.min.js}"></script>
<script
        th:src="@{/plugins/bootstrap-slider/bootstrap-slider.js}"></script>
<script
        th:src="@{/plugins/bootstrap-datetimepicker/bootstrap-datetimepicker.min.js}"></script>

<script>

    function validateAge(age) {
        reg=/^(?:[1-9][0-9]?|1[01][0-9]|120)$/;//年龄是1-120之间有效
        if(value == undefined){
            alert('帐号输入不合法');
        }else{
            if (value && value.length > 0) {
                if(!reg.test(value)){
                    callback([new Error('年龄输入不合法')]);
                }else{
                    callback();
                }
            } else if(value.length == 0){
                callback();
            }else {
                callback(new Error('年龄输入不合法'));
            }
        }
    }
    function IdentityCodeValid(code) {
                    var city={11:"北京",12:"天津",13:"河北",14:"山西",15:"内蒙古",21:"辽宁",22:"吉林",23:"黑龙江 ",31:"上海",32:"江苏",33:"浙江",34:"安徽",35:"福建",36:"江西",37:"山东",41:"河南",42:"湖北 ",43:"湖南",44:"广东",45:"广西",46:"海南",50:"重庆",51:"四川",52:"贵州",53:"云南",54:"西藏 ",61:"陕西",62:"甘肃",63:"青海",64:"宁夏",65:"新疆",71:"台湾",81:"香港",82:"澳门",91:"国外 "};
                   var tip = "";
                   var pass= true;

                  if(!code || !/^\d{6}(18|19|20)?\d{2}(0[1-9]|1[012])(0[1-9]|[12]\d|3[01])\d{3}(\d|X)$/i.test(code)){
                             tip = "身份证号格式错误";
                          pass = false;
                       }

                   else if(!city[code.substr(0,2)]){
                             tip = "地址编码错误";
                           pass = false;
                        }
                     else{
                            //18位身份证需要验证最后一位校验位
                          if(code.length == 18){
                                 code = code.split('');
                                  //∑(ai×Wi)(mod 11)
                                 //加权因子
                                  var factor = [ 7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2 ];
                                   //校验位
                                  var parity = [ 1, 0, 'X', 9, 8, 7, 6, 5, 4, 3, 2 ];
                                 var sum = 0;
                                 var ai = 0;
                                var wi = 0;
                                for (var i = 0; i < 17; i++)
                                        {
                                            ai = code[i];
                                            wi = factor[i];
                                           sum += ai * wi;
                                       }
                                 var last = parity[sum % 11];
                                   if(parity[sum % 11] != code[17]){
                                            tip = "校验位错误";
                                           pass =false;
                                        }
                                }
                        }
                   if(!pass) alert(tip);
                     return pass;
              }
    function validatemobile(mobile)
    {
        if(mobile.length==0)
        {
            alert('手机号码不能为空！');
            return false;
        }
        if(mobile.length!=11)
        {
            alert('请输入有效的手机号码，需是11位！');
            return false;
        }

        var myreg = /^(((13[0-9]{1})|(15[0-9]{1})|(18[0-9]{1}))+\d{8})$/;
        if(!myreg.test(mobile))
        {
            alert('请输入有效的手机号码！');
            return false;
        }
    }

    $(document).ready(function() {
        // 选择框
        $(".select2").select2();

        // WYSIHTML5编辑器
        $(".textarea").wysihtml5({
            locale : 'zh-CN'
        });
    });

    // 设置激活菜单
    function setSidebarActive(tagUri) {
        var liObj = $("#" + tagUri);
        if (liObj.length > 0) {
            liObj.parent().parent().addClass("active");
            liObj.addClass("active");
        }
    }

    $(document).ready(function() {
        $('#datepicker-a3').datetimepicker({
            format : "yyyy-mm-dd hh:ii",
            autoclose : true,
            todayBtn : true,
            language : "zh-CN"
        });
    });

    $(document).ready(function() {
        // 激活导航位置
        setSidebarActive("order-manage");
        $("#datepicker-a3").datetimepicker({
            format : "yyyy-mm-dd hh:ii",

        });

    });
</script>


</body>

</html>